Script not able to work on Server 2003
Script not able to work on Server 2003
am 07.10.2007 21:57:17 von joe
I have PERL scripst that I created on a Windows 2000 Server, that work
great. We switched to a Windows 2003 Server, PERL is installed, but my
script that works on 2000, will not work with the 2003 server. I keep
getting the following error on all my scripts:
"Content-type: text/html
'C:\Inetpub\wwwroot\cgi-bin\Employee_Status\employee_status. cgi'
script produced no output"
Plus, I have tried changing the extension to cgi, and I get the same
error.
Does anyone have any suggestions for me? I'm almost positive it is
something simple, but I am just not seeing it.
Re: Script not able to work on Server 2003
am 07.10.2007 23:20:03 von Tad McClellan
Joe wrote:
> I have PERL scripst that I created on a Windows 2000 Server, that work
> great. We switched to a Windows 2003 Server, PERL is installed, but my
> script that works on 2000, will not work with the 2003 server. I keep
> getting the following error on all my scripts:
>
> "Content-type: text/html
>
> 'C:\Inetpub\wwwroot\cgi-bin\Employee_Status\employee_status. cgi'
> script produced no output"
>
> Plus, I have tried changing the extension to cgi, and I get the same
> error.
>
> Does anyone have any suggestions for me? I'm almost positive it is
> something simple, but I am just not seeing it.
I'm almost positive it has nothing to do with Perl.
It likely has to do with web server configuration.
Ask in a newsgroup about web servers.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
Re: Script not able to work on Server 2003
am 08.10.2007 00:23:20 von joe
Good suggestion, but the one thing I forgot to mention is, another
person wrote scripts a few years ago, and those, basically work out of
the box. His and mine are somewhat identical, but his work and mine
don't.
I have check for differences in coding style, and some we are fairly
close and other note. The big difference from his and mine are that
most of his are links in .asp pages, mine are just straight links.
Possibly it has something to do with the way IIS is calling it. Most
of my scripts do not have much to do with IIS. I'm sorry I'm rabling,
I just been looking at this all weekend.
Re: Script not able to work on Server 2003
am 08.10.2007 01:01:50 von veatchla
Joe wrote:
> Good suggestion, but the one thing I forgot to mention is, another
> person wrote scripts a few years ago, and those, basically work out of
> the box. His and mine are somewhat identical, but his work and mine
> don't.
>
> I have check for differences in coding style, and some we are fairly
> close and other note. The big difference from his and mine are that
> most of his are links in .asp pages, mine are just straight links.
>
> Possibly it has something to do with the way IIS is calling it. Most
> of my scripts do not have much to do with IIS. I'm sorry I'm rabling,
> I just been looking at this all weekend.
>
Write the output to a file and compare how many carriage returns does
your code and the the other person's code that works send after
Content-type: text/html ?
--
Len
Re: Script not able to work on Server 2003
am 08.10.2007 04:53:19 von Ron Bergin
On Oct 7, 3:23 pm, Joe wrote:
> Good suggestion, but the one thing I forgot to mention is, another
> person wrote scripts a few years ago, and those, basically work
Without seeing you coder and knowing how your web server is
configured, it's anyones guess as to the problem/solution.
> His and mine are somewhat identical, but his work ....
^^^^^^^^^^^^^^^^^^
That's probably the key. What's the difference between yours and his?
>
> I have check for differences in coding style, and some we are fairly
> close and other note. The big difference from his and mine are that
> most of his are links in .asp pages, mine are just straight links.
Show us your code. Style is just style, what it's doing is most
important. We may not be able to troubleshoot the asp side, but if we
see your Perl code, we may be able to find the problem/solution.
>
> Possibly it has something to do with the way IIS is calling it.
That may be the case, and if so, we'll probably direct you to posting
in an IIS forum, but without seeing your code, it's impossible to say.
Re: Script not able to work on Server 2003
am 09.10.2007 01:10:46 von joe
Here is my code, I picked one of my shorter scripts:
#!/usr/bin/perl -w
# Joe Ruffino Daily WebOpac.pl
# This program will read in a text file, and print it out
# in table format
# Written: January 30, 2004
# Revised: December 09, 2004, Jan 03, 2005
use CGI qw(:standard :html3);
use CGI::Carp qw(fatalsToBrowser);
use strict;
############################################################ ##############
# Set Variables
#
my $ip_hold = 0;
my $sec;
my $min;
my $hour;
my $day;
my $month;
my $year;
my $ip_list;
my $monthfind;
my $monthm;
my $countip;
my $stationip;
my $stationname;
my @stationip;
my @stationname;
my $dayopac;
my $daym;
my $dayopacm;
my $dayfind;
my $headerpage;
my $dayflag;
my $namev;
my $one;
my $two;
my $three;
my $monthcurr;
my $monthnow;
my $countin;
my $countout;
my $ip;
my $date;
my $time;
my $firstp;
my $secondp;
my $thirdp;
my $fourthp;
my $firstip;
my @firstip;
my $sn;
my $count;
my $date_month;
my $date_day;
my $date_year;
my $i;
my $ips;
my @Names;
my %Names;
my $ext_ip;
my %seen;
my $countint;
my $totalcnt;
my $totalline;
my $station_name;
my @opacline;
my %count;
my @staionip;
my $line;
my $opac_month;
my $hold_date;
my $date_cnt;
my $ip_day_cnt;
my $day_array;
my $ip_day_cnt;
my $four;
my @ext_line;
my %day_array;
my %letters;
my $tot_ip_cnt;
my $ip_cnt;
my $four;
############################################################ ##############
# Subroutine for finding the text month when numerical month is given
#
sub dayfind {
#Setup date field
if ($dayopacm eq "01") {
$dayfind = "January"; }
if ($dayopacm eq "02") {
$dayfind = "February"; }
if ($dayopacm eq "03") {
$dayfind = "March"; }
if ($dayopacm eq "04") {
$dayfind = "April"; }
if ($dayopacm eq "05") {
$dayfind = "May"; }
if ($dayopacm eq "06") {
$dayfind = "June"; }
if ($dayopacm eq "07") {
$dayfind = "July"; }
if ($dayopacm eq "08") {
$dayfind = "August"; }
if ($dayopacm eq "09") {
$dayfind = "September"; }
if ($dayopacm eq "10") {
$dayfind = "October"; }
if ($dayopacm eq "11") {
$dayfind = "November"; }
if ($dayopacm eq "12") {
$dayfind = "December"; }
return $dayfind;
}
############################################################ ##############
# Subroutine for finding the numerical month when text month is given
#
sub monthfind {
#Setup date field
if ($monthm eq "Jan") {
$monthfind = "01"; }
if ($monthm eq "Feb") {
$monthfind = "02"; }
if ($monthm eq "Mar") {
$monthfind = "03"; }
if ($monthm eq "Apr") {
$monthfind = "04"; }
if ($monthm eq "May") {
$monthfind = "05"; }
if ($monthm eq "Jun") {
$monthfind = "06"; }
if ($monthm eq "Jul") {
$monthfind = "07"; }
if ($monthm eq "Aug") {
$monthfind = "08"; }
if ($monthm eq "Sep") {
$monthfind = "09"; }
if ($monthm eq "Oct") {
$monthfind = "10"; }
if ($monthm eq "Nov") {
$monthfind = "11"; }
if ($monthm eq "Dec") {
$monthfind = "12"; }
return $monthfind;
}
############################################################ ##############
# Find current Time and Date info
#
($sec,$min,$hour,$day,$month,$year) = localtime(time);
$year = $year +1900;
# ignore used for testing
$ip_list = "OpacIP";
# ignore used for testing
############################################################ ##############
# Open IP file and test data file
# Then split IP file into IP address and Station Name array's
#
open (LISTIN,"ipnew.txt") || die "Cannot Open File ipadd.txt for
reading: $!";
while () {
($staionip[$countip], $stationname[$countip]) = split(/\s+/);
$countip++;
}
$stationip = @stationip;
$stationname = $stationname;
close (LISTIN);
############################################################ ##############
# If a file name has been given, process the file
#
$line = 0;
if (param()) {
# Set filename entered to a variable
my $dayopac = param("dayopac");
# Split file name into month and day by assuming a dash is there
($dayopacm, $daym) = split(/-/, $dayopac);
if ($daym) { # if there is a 2-digit day
$dayflag = "yes";
# find the text month by sending the 2-digit month
$monthfind = dayfind($dayopacm);
if ($monthfind eq "December") {
#$year = $year -1;
}
$headerpage = "Daily Stats for " . $monthfind . " " . $daym . ",
" . $year;
} else {
# if not a day to be procressed, check to see if it is a month
to
# be processed
$dayflag = "no";
$daym = "01";
# Split file name into process name and month by assuming an
# underscore is there
($namev, $monthm) = split(/_/, $dayopac);
# find the 2-digit month by sending the text month
$monthcurr = monthfind($monthm);
# if current month is equal to the month entered
if ($month eq $monthcurr) { # if it is 1 - 9
if ($month > 9) {
$dayopacm = $month; # set current month to month holder
} else {
# set current month to month holder and append a '0
$dayopacm = "0" . $month;
}
} else {
# if not equal set month entered to month holder
$dayopacm = $monthcurr;
}
# Go to subroutine to find the FULL text month
$monthnow = dayfind($dayopacm);
if ($monthnow eq "December") {
$year--;
}
($one, $two, $three, $four) = split(/\\/, $dayopac);
# Set title for HTML Output page using text month that was found
$headerpage = "Monthly Stats for $monthnow $year";
}
$ip_list .= "_" . $monthm .".txt";
open (OPAC_IP, ">$ip_list") || die "$ip_list open failed: $!";
$opac_month = $dayopac . "_" . $year . ".html";
open (OPAC_WEB, ">$opac_month") || die "$ip_list open failed: $!";
# Append .txt to filename given, and open file for reading
$dayopac .= ".txt";
open (OPAC,$dayopac) || die ($dayopac . " open failed: $!");
# Print title on new HTML page and first line
print OPAC_WEB <
WebOpac $headerpage
$headerpage
END
($ip,$date,$time,$sn) = split(/ +/);
$hold_date = $dayopacm . "-" . $daym . "-" . substr(($year - 1900),
1,2);
$countin = 0; # zero out counter for ip numbers used in an
array
$date_cnt = 0;
$ip_day_cnt = 0;
while () {
chomp;
$countout++; # count number of records processed
($ip,$date,$time,$sn) = split(/ +/);
# If IP is internal, process
if ($ip =~ /192.168.33/) {
# Split IP in to 4 parts using a period
($firstp,$secondp,$thirdp,$fourthp) = split(/\./, $ip);
# If IP is between 1 and 9, append 00 to it
if ($fourthp > 0 && $fourthp < 10) {
$fourthp = "00" . $fourthp;
} else {
# If IP is between 10 and 99, append 0 to it
if ($fourthp > 9 && $fourthp < 100) {
$fourthp = "0" . $fourthp;
}
}
# Assign IP to an array element
$firstip[$countin] = $fourthp;
# Add 1 to array counter
$countin++;
} else {
if ($date ne $hold_date) {
foreach $ip (sort keys %day_array) {
$ip_day_cnt++;
}
$tot_ip_cnt += $ip_day_cnt;
$ext_line[$line] = "" . $hold_date . " has " .
$ip_day_cnt . " unique External IPs.";
$date_cnt = 0;
$ip_day_cnt = 0;
%day_array = " ";
$line++;
}
$ext_ip++;
$letters{$ip} = 1;
$day_array{$ip} = 1;
$date_cnt++;
}
$hold_date = $date;
}
foreach $ip (sort keys %day_array) {
$ip_day_cnt++;
}
$tot_ip_cnt += $ip_day_cnt;
$ext_line[$line] = "" . $hold_date . " has " .
$ip_day_cnt . " unique External IPs.
";
# print OPAC_IP @Names;
close (OPAC_IP);
foreach $ip (sort keys %letters) {
$ip_cnt++;
}
#print "
$ip_cnt";
# Set length of array to variable
$countint = @firstip;
# Tally distinctive ips
foreach $ips(@firstip) {
$count{$ips}++;
}
foreach $ips(sort(keys %count)) {
for ($i = 0; $i <= $countip; $i++) {
if ($ips == $staionip[$i]) {
$opacline[$totalcnt] = "The Station ".$stationname[$i]."
b> with IP ".$ips. " has visited Opac ".
$count{$ips}." times.\n";
$totalcnt++;
if ( $count{$ips} > $ip_hold) {
$ip_hold = $count{$ips};
$station_name = $i;
}
}
}
}
close(OPAC);
if ($countint == 0) { $totalcnt = 0;}
if ($dayflag eq "yes") {
$totalline = "There are " . $totalcnt . " total
patron stations used for " . $monthfind . " " . $daym . "
b>.";
} else {
$totalline = "There are " . $totalcnt . " total
patron stations used for the Month of " . $monthnow . "
b>.";
}
print OPAC_WEB hr();
print OPAC_WEB p("There are " . $countint . "
internal IP address hits.");
print OPAC_WEB p("There are " . $ext_ip . " external
IP address hits.");
# print p("There are " . ($countout-$countin) . "
external IP address hits.");
print OPAC_WEB p("There are " . $countout . " total
IP address hits.");
print OPAC_WEB p($totalline);
print OPAC_WEB p("The Station ".
$stationname[$station_name]." has the greatest number of hits
of ".$ip_hold." times.");
print OPAC_WEB p("There are " . $tot_ip_cnt . " Total
unique External IP hits for All Days in $monthnow.");
print OPAC_WEB p("There are " . $ip_cnt . " unique
External IP hits for the Month of $monthnow.");
print OPAC_WEB "";
print OPAC_WEB "Internal<\/A><\/font>";
print OPAC_WEB "External Hits<\/a> ";
print OPAC_WEB hr();
for ($i = 0; $i <= $totalcnt; $i++) {
print OPAC_WEB p($opacline[$i]);
}
print OPAC_WEB hr();
print OPAC_WEB "";
print OPAC_WEB "External<\/A><\/font>";
print OPAC_WEB "Internal Hits<\/a>";
print OPAC_WEB p(@ext_line);
print OPAC_WEB hr();
print OPAC_WEB "
";
use CGI; print redirect("$opac_month");
} else {
############################################################ ##############
# If a file name has not been given, process the file, create webpage
to
# ask for it
#
print header, start_html("Monthly WebOpac"), h1("Monthly WebOpac
Report");
print hr();
print start_form();
print p("Day File: ",textfield("dayopac"), " * form should be
WebOpac_(3-letter Month)");
# print p("Check Test: ",checkbox("opaccheck"));
print p(submit("Submit Entry"));
print end_form(), hr();
}
print end_html;
Re: Script not able to work on Server 2003
am 09.10.2007 04:12:34 von paduille.4061.mumia.w+nospam
On 10/08/2007 06:10 PM, Joe wrote:
> Here is my code, I picked one of my shorter scripts:
>
> #!/usr/bin/perl -w
>
> # Joe Ruffino Daily WebOpac.pl
> # This program will read in a text file, and print it out
> # in table format
> # Written: January 30, 2004
> # Revised: December 09, 2004, Jan 03, 2005
>
> use CGI qw(:standard :html3);
> use CGI::Carp qw(fatalsToBrowser);
> use strict;
>
>
> ############################################################ ##############
> # Set Variables
> #
>
> my $ip_hold = 0;
> my $sec;
> my $min;
> my $hour;
> my $day;
> my $month;
> my $year;
> my $ip_list;
> my $monthfind;
> my $monthm;
> my $countip;
>
> my $stationip;
> my $stationname;
>
> my @stationip;
> my @stationname;
>
> my $dayopac;
> my $daym;
> my $dayopacm;
> my $dayfind;
> my $headerpage;
> my $dayflag;
> my $namev;
> my $one;
> my $two;
> my $three;
> my $monthcurr;
> my $monthnow;
> my $countin;
> my $countout;
> my $ip;
> my $date;
> my $time;
> my $firstp;
> my $secondp;
> my $thirdp;
> my $fourthp;
> my $firstip;
> my @firstip;
> my $sn;
> my $count;
> my $date_month;
> my $date_day;
> my $date_year;
> my $i;
> my $ips;
> my @Names;
> my %Names;
> my $ext_ip;
> my %seen;
> my $countint;
> my $totalcnt;
> my $totalline;
> my $station_name;
> my @opacline;
> my %count;
> my @staionip;
> my $line;
> my $opac_month;
> my $hold_date;
> my $date_cnt;
> my $ip_day_cnt;
> my $day_array;
> my $ip_day_cnt;
> my $four;
> my @ext_line;
> my %day_array;
> my %letters;
> my $tot_ip_cnt;
> my $ip_cnt;
> my $four;
>
> ############################################################ ##############
> # Subroutine for finding the text month when numerical month is given
> #
> sub dayfind {
>
> #Setup date field
> if ($dayopacm eq "01") {
> $dayfind = "January"; }
>
> if ($dayopacm eq "02") {
> $dayfind = "February"; } [...]
Use data to simplify code (untested):
my @monthnames = qw(
January February March April May June
July August September October November December ) ;
my %monthnames;
@monthnames{ @monthnames } = 1 .. @monthnames ;
my %rMonthnames = reverse %monthnames;
sub dayfind {
$dayfind = $monthnames{$dayopacm};
}
sub monthfind {
$monthfind = $rMonthnames{$monthm};
sprintf('%02d', $monthfind);
}
>
> if ($dayopacm eq "03") {
> $dayfind = "March"; }
>
> if ($dayopacm eq "04") {
> $dayfind = "April"; }
>
> if ($dayopacm eq "05") {
> $dayfind = "May"; }
>
> if ($dayopacm eq "06") {
> $dayfind = "June"; }
>
> if ($dayopacm eq "07") {
> $dayfind = "July"; }
>
> if ($dayopacm eq "08") {
> $dayfind = "August"; }
>
> if ($dayopacm eq "09") {
> $dayfind = "September"; }
>
> if ($dayopacm eq "10") {
> $dayfind = "October"; }
>
> if ($dayopacm eq "11") {
> $dayfind = "November"; }
>
> if ($dayopacm eq "12") {
> $dayfind = "December"; }
> return $dayfind;
> }
>
> ############################################################ ##############
> # Subroutine for finding the numerical month when text month is given
> #
> sub monthfind {
>
> #Setup date field
> if ($monthm eq "Jan") {
> $monthfind = "01"; }
>
> if ($monthm eq "Feb") {
> $monthfind = "02"; }
>
> if ($monthm eq "Mar") {
> $monthfind = "03"; }
>
> if ($monthm eq "Apr") {
> $monthfind = "04"; }
>
> if ($monthm eq "May") {
> $monthfind = "05"; }
>
> if ($monthm eq "Jun") {
> $monthfind = "06"; }
>
> if ($monthm eq "Jul") {
> $monthfind = "07"; }
>
> if ($monthm eq "Aug") {
> $monthfind = "08"; }
>
> if ($monthm eq "Sep") {
> $monthfind = "09"; }
>
> if ($monthm eq "Oct") {
> $monthfind = "10"; }
>
> if ($monthm eq "Nov") {
> $monthfind = "11"; }
>
> if ($monthm eq "Dec") {
> $monthfind = "12"; }
> return $monthfind;
> }
>
> ############################################################ ##############
> # Find current Time and Date info
> #
> ($sec,$min,$hour,$day,$month,$year) = localtime(time);
> $year = $year +1900;
>
> # ignore used for testing
> $ip_list = "OpacIP";
> # ignore used for testing
>
> ############################################################ ##############
> # Open IP file and test data file
> # Then split IP file into IP address and Station Name array's
> #
> open (LISTIN,"ipnew.txt") || die "Cannot Open File ipadd.txt for
> reading: $!";
>
> while () {
> ($staionip[$countip], $stationname[$countip]) = split(/\s+/);
> $countip++;
> }
Huh? Why do you advance the field counter ($countip) each time through
the loop? Now you get both a different record and a different field with
each iteration.
>
> $stationip = @stationip;
> $stationname = $stationname;
>
> close (LISTIN);
>
>
> ############################################################ ##############
> # If a file name has been given, process the file
> #
>
> $line = 0;
> if (param()) {
>
> # Set filename entered to a variable
> my $dayopac = param("dayopac");
>
> # Split file name into month and day by assuming a dash is there
> ($dayopacm, $daym) = split(/-/, $dayopac);
> if ($daym) { # if there is a 2-digit day
> $dayflag = "yes";
>
> # find the text month by sending the 2-digit month
> $monthfind = dayfind($dayopacm);
Dayfind does not use any arguments from its argument list, yet you give
it an argument anyway--why?
> if ($monthfind eq "December") {
> #$year = $year -1;
> }
> $headerpage = "Daily Stats for " . $monthfind . " " . $daym . ",
> " . $year;
> } else {
>
> # if not a day to be procressed, check to see if it is a month
> to
> # be processed
> $dayflag = "no";
> $daym = "01";
>
> # Split file name into process name and month by assuming an
> # underscore is there
> ($namev, $monthm) = split(/_/, $dayopac);
>
> # find the 2-digit month by sending the text month
> $monthcurr = monthfind($monthm);
>
> # if current month is equal to the month entered
> if ($month eq $monthcurr) { # if it is 1 - 9
> if ($month > 9) {
> $dayopacm = $month; # set current month to month holder
> } else {
> # set current month to month holder and append a '0
> $dayopacm = "0" . $month;
> }
> } else {
> # if not equal set month entered to month holder
> $dayopacm = $monthcurr;
> }
> # Go to subroutine to find the FULL text month
> $monthnow = dayfind($dayopacm);
> if ($monthnow eq "December") {
> $year--;
> }
> ($one, $two, $three, $four) = split(/\\/, $dayopac);
>
> # Set title for HTML Output page using text month that was found
> $headerpage = "Monthly Stats for $monthnow $year";
> }
>
> $ip_list .= "_" . $monthm .".txt";
> open (OPAC_IP, ">$ip_list") || die "$ip_list open failed: $!";
>
> $opac_month = $dayopac . "_" . $year . ".html";
> open (OPAC_WEB, ">$opac_month") || die "$ip_list open failed: $!";
>
> # Append .txt to filename given, and open file for reading
> $dayopac .= ".txt";
> open (OPAC,$dayopac) || die ($dayopac . " open failed: $!");
>
> # Print title on new HTML page and first line
> print OPAC_WEB <
>
>
>
> WebOpac $headerpage
>
>
> $headerpage
> END
>
> ($ip,$date,$time,$sn) = split(/ +/);
> $hold_date = $dayopacm . "-" . $daym . "-" . substr(($year - 1900),
> 1,2);
>
> $countin = 0; # zero out counter for ip numbers used in an
> array
> $date_cnt = 0;
> $ip_day_cnt = 0;
>
> while () {
> chomp;
> $countout++; # count number of records processed
>
> ($ip,$date,$time,$sn) = split(/ +/);
>
> # If IP is internal, process
> if ($ip =~ /192.168.33/) {
>
> # Split IP in to 4 parts using a period
> ($firstp,$secondp,$thirdp,$fourthp) = split(/\./, $ip);
>
> # If IP is between 1 and 9, append 00 to it
> if ($fourthp > 0 && $fourthp < 10) {
> $fourthp = "00" . $fourthp;
> } else {
>
> # If IP is between 10 and 99, append 0 to it
> if ($fourthp > 9 && $fourthp < 100) {
> $fourthp = "0" . $fourthp;
> }
> }
> # Assign IP to an array element
> $firstip[$countin] = $fourthp;
>
> # Add 1 to array counter
> $countin++;
> } else {
> if ($date ne $hold_date) {
> foreach $ip (sort keys %day_array) {
> $ip_day_cnt++;
> }
> $tot_ip_cnt += $ip_day_cnt;
> $ext_line[$line] = "" . $hold_date . " has " .
> $ip_day_cnt . " unique External IPs.";
> $date_cnt = 0;
> $ip_day_cnt = 0;
> %day_array = " ";
> $line++;
> }
> $ext_ip++;
> $letters{$ip} = 1;
> $day_array{$ip} = 1;
> $date_cnt++;
> }
> $hold_date = $date;
> }
> [...]
I stopped reading here. The large number of global variables you used
and the large amount of text you posted make it not worth my while to
continue.
Your program is confusing because its functions are 10x the size they
need to be to get the job done, and you went hog-wild with the global
variables.
A debugger is available for Perl, but it'll cost you¹. However, creating
the right environment for the debugger will be a challenge. If you
haven't done so already, read the posting guidelines². They suggest
creating the shortest but runnable program that demonstrates your
problem; ninety per cent of the time, doing so reveals the bug.
--------------------
¹ $0.00. Try this: perl -d Web0pac.pl
² http://www.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines. html
Re: Script not able to work on Server 2003
am 09.10.2007 04:19:20 von Dummy
Joe wrote:
> Here is my code, I picked one of my shorter scripts:
>
> #!/usr/bin/perl -w
>
> # Joe Ruffino Daily WebOpac.pl
> # This program will read in a text file, and print it out
> # in table format
> # Written: January 30, 2004
> # Revised: December 09, 2004, Jan 03, 2005
>
> use CGI qw(:standard :html3);
> use CGI::Carp qw(fatalsToBrowser);
> use strict;
>
>
> ############################################################ ##############
> # Set Variables
> #
You should declare your variables in the smallest scope possible instead of
all here.
[ SNIP ]
> ############################################################ ##############
> # Subroutine for finding the text month when numerical month is given
> #
> sub dayfind {
>
> #Setup date field
> if ($dayopacm eq "01") {
> $dayfind = "January"; }
> ############################################################ ##############
> # Subroutine for finding the numerical month when text month is given
> #
> sub monthfind {
>
> #Setup date field
> if ($monthm eq "Jan") {
> $monthfind = "01"; }
Just use hashes instead of subroutines:
my %dayfind = qw( 01 January 02 February 03 March 04 April 05 May 06 June 07
July 08 August 09 September 10 October 11 November 12 December );
my %monthfind = qw( Jan 01 Feb 02 Mar 03 Apr 04 May 05 Jun 06 Jul 07 Aug 08
Sep 09 Oct 10 Nov 11 Dec 12 );
> ############################################################ ##############
> # Find current Time and Date info
> #
> ($sec,$min,$hour,$day,$month,$year) = localtime(time);
> $year = $year +1900;
You don't use $sec, $min, $hour or $day so:
my ( $month, $year ) = ( localtime )[ 4, 5 ];
$year += 1900;
> # ignore used for testing
> $ip_list = "OpacIP";
> # ignore used for testing
>
> ############################################################ ##############
> # Open IP file and test data file
> # Then split IP file into IP address and Station Name array's
> #
> open (LISTIN,"ipnew.txt") || die "Cannot Open File ipadd.txt for
> reading: $!";
>
> while () {
> ($staionip[$countip], $stationname[$countip]) = split(/\s+/);
> $countip++;
> }
>
> $stationip = @stationip;
> $stationname = $stationname;
Shouldn't that be:
my $stationip = @stationip;
my $stationname = @stationname;
But you never use the variables $stationip and $stationname anyway.
> close (LISTIN);
>
>
> ############################################################ ##############
> # If a file name has been given, process the file
> #
>
> $line = 0;
> if (param()) {
>
> # Set filename entered to a variable
> my $dayopac = param("dayopac");
>
> # Split file name into month and day by assuming a dash is there
> ($dayopacm, $daym) = split(/-/, $dayopac);
> if ($daym) { # if there is a 2-digit day
> $dayflag = "yes";
>
> # find the text month by sending the 2-digit month
> $monthfind = dayfind($dayopacm);
> if ($monthfind eq "December") {
> #$year = $year -1;
> }
> $headerpage = "Daily Stats for " . $monthfind . " " . $daym . ",
> " . $year;
> } else {
>
> # if not a day to be procressed, check to see if it is a month
> to
> # be processed
> $dayflag = "no";
> $daym = "01";
>
> # Split file name into process name and month by assuming an
> # underscore is there
> ($namev, $monthm) = split(/_/, $dayopac);
>
> # find the 2-digit month by sending the text month
> $monthcurr = monthfind($monthm);
>
> # if current month is equal to the month entered
> if ($month eq $monthcurr) { # if it is 1 - 9
> if ($month > 9) {
> $dayopacm = $month; # set current month to month holder
> } else {
> # set current month to month holder and append a '0
> $dayopacm = "0" . $month;
> }
> } else {
> # if not equal set month entered to month holder
> $dayopacm = $monthcurr;
> }
$monthcurr = $monthfind{ ( split /_/, $dayopac )[ 1 ] }
$dayopacm = sprintf '%02d', $month eq $monthcurr ? $month : $monthcurr;
> # Go to subroutine to find the FULL text month
> $monthnow = dayfind($dayopacm);
$monthnow = $dayfind{ $dayopacm };
> if ($monthnow eq "December") {
> $year--;
> }
> ($one, $two, $three, $four) = split(/\\/, $dayopac);
You never use these variables anywhere?
> # Set title for HTML Output page using text month that was found
> $headerpage = "Monthly Stats for $monthnow $year";
> }
>
> $ip_list .= "_" . $monthm .".txt";
> open (OPAC_IP, ">$ip_list") || die "$ip_list open failed: $!";
>
> $opac_month = $dayopac . "_" . $year . ".html";
> open (OPAC_WEB, ">$opac_month") || die "$ip_list open failed: $!";
>
> # Append .txt to filename given, and open file for reading
> $dayopac .= ".txt";
> open (OPAC,$dayopac) || die ($dayopac . " open failed: $!");
>
> # Print title on new HTML page and first line
> print OPAC_WEB <
>
>
>
> WebOpac $headerpage
>
>
> $headerpage
> END
>
> ($ip,$date,$time,$sn) = split(/ +/);
> $hold_date = $dayopacm . "-" . $daym . "-" . substr(($year - 1900),
> 1,2);
$hold_date = sprintf '%s-%s-%02d', $dayopacm, $daym, $year % 100
> $countin = 0; # zero out counter for ip numbers used in an
> array
> $date_cnt = 0;
> $ip_day_cnt = 0;
>
> while () {
> chomp;
> $countout++; # count number of records processed
>
> ($ip,$date,$time,$sn) = split(/ +/);
>
> # If IP is internal, process
> if ($ip =~ /192.168.33/) {
> if ( $ip =~ /^192\.168\.33/ ) {
> # Split IP in to 4 parts using a period
> ($firstp,$secondp,$thirdp,$fourthp) = split(/\./, $ip);
You never use $firstp, $secondp and $thirdp so ...
> # If IP is between 1 and 9, append 00 to it
> if ($fourthp > 0 && $fourthp < 10) {
> $fourthp = "00" . $fourthp;
> } else {
>
> # If IP is between 10 and 99, append 0 to it
> if ($fourthp > 9 && $fourthp < 100) {
> $fourthp = "0" . $fourthp;
> }
> }
$fourthp = sprintf '%03d', ( split /\./, $ip )[ 3 ];
> # Assign IP to an array element
> $firstip[$countin] = $fourthp;
>
> # Add 1 to array counter
> $countin++;
> } else {
> if ($date ne $hold_date) {
> foreach $ip (sort keys %day_array) {
> $ip_day_cnt++;
> }
$ip_day_cnt += keys %day_array;
> $tot_ip_cnt += $ip_day_cnt;
> $ext_line[$line] = "" . $hold_date . " has " .
> $ip_day_cnt . " unique External IPs.";
> $date_cnt = 0;
> $ip_day_cnt = 0;
> %day_array = " ";
> $line++;
> }
> $ext_ip++;
> $letters{$ip} = 1;
> $day_array{$ip} = 1;
> $date_cnt++;
> }
> $hold_date = $date;
> }
>
> foreach $ip (sort keys %day_array) {
> $ip_day_cnt++;
> }
$ip_day_cnt += keys %day_array;
> $tot_ip_cnt += $ip_day_cnt;
> $ext_line[$line] = "" . $hold_date . " has " .
> $ip_day_cnt . " unique External IPs.
";
>
> # print OPAC_IP @Names;
> close (OPAC_IP);
>
> foreach $ip (sort keys %letters) {
> $ip_cnt++;
> }
$ip_cnt += keys %letters;
> #print "
$ip_cnt";
> # Set length of array to variable
> $countint = @firstip;
>
> # Tally distinctive ips
> foreach $ips(@firstip) {
> $count{$ips}++;
> }
>
> foreach $ips(sort(keys %count)) {
> for ($i = 0; $i <= $countip; $i++) {
> if ($ips == $staionip[$i]) {
> $opacline[$totalcnt] = "The Station ".$stationname[$i]."
> b> with IP ".$ips. " has visited Opac ".
> $count{$ips}." times.\n";
> $totalcnt++;
> if ( $count{$ips} > $ip_hold) {
> $ip_hold = $count{$ips};
> $station_name = $i;
> }
> }
>
> }
> }
> close(OPAC);
>
> if ($countint == 0) { $totalcnt = 0;}
>
> if ($dayflag eq "yes") {
> $totalline = "There are " . $totalcnt . " total
> patron stations used for " . $monthfind . " " . $daym . "
> b>.";
> } else {
> $totalline = "There are " . $totalcnt . " total
> patron stations used for the Month of " . $monthnow . "
> b>.";
> }
> print OPAC_WEB hr();
> print OPAC_WEB p("There are " . $countint . "
> internal IP address hits.");
> print OPAC_WEB p("There are " . $ext_ip . " external
> IP address hits.");
> # print p("There are " . ($countout-$countin) . "
> external IP address hits.");
> print OPAC_WEB p("There are " . $countout . " total
> IP address hits.");
> print OPAC_WEB p($totalline);
> print OPAC_WEB p("The Station ".
> $stationname[$station_name]." has the greatest number of hits
> of ".$ip_hold." times.");
> print OPAC_WEB p("There are " . $tot_ip_cnt . " Total
> unique External IP hits for All Days in $monthnow.");
> print OPAC_WEB p("There are " . $ip_cnt . " unique
> External IP hits for the Month of $monthnow.");
> print OPAC_WEB "";
> print OPAC_WEB "Internal<\/A><\/font>";
> print OPAC_WEB "External Hits<\/a> ";
> print OPAC_WEB hr();
>
> for ($i = 0; $i <= $totalcnt; $i++) {
> print OPAC_WEB p($opacline[$i]);
> }
> print OPAC_WEB hr();
> print OPAC_WEB "";
> print OPAC_WEB "External<\/A><\/font>";
> print OPAC_WEB "Internal Hits<\/a>";
> print OPAC_WEB p(@ext_line);
> print OPAC_WEB hr();
> print OPAC_WEB "
";
Instead of 21 + $totalcnt calls to print() just print once:
print OPAC_WEB
hr(),
p( "There are $countint internal IP address hits." ),
p( "There are $ext_ip external IP address hits." ),
p( "There are $countout total IP address hits." ),
p( $totalline ),
p( "The Station $stationname[$station_name] has the
greatest number of hits of $ip_hold times." ),
p( "There are " . $tot_ip_cnt . " Total unique External
IP hits for All Days in $monthnow." ),
p( "There are " . $ip_cnt . " unique External IP hits
for the Month of $monthnow." ),
"",
"Internal<\/A><\/font>",
"External Hits<\/a> ",
hr(),
map( p( $opacline[ $_ ] ), 0 .. $totalcnt ),
hr(),
"",
"External<\/A><\/font>",
"Internal Hits<\/a>",
p( @ext_line ),
hr(),
"";
> use CGI; print redirect("$opac_month");
> } else {
>
> ############################################################ ##############
> # If a file name has not been given, process the file, create webpage
> to
> # ask for it
> #
> print header, start_html("Monthly WebOpac"), h1("Monthly WebOpac
> Report");
>
> print hr();
> print start_form();
> print p("Day File: ",textfield("dayopac"), " * form should be
> WebOpac_(3-letter Month)");
> # print p("Check Test: ",checkbox("opaccheck"));
>
> print p(submit("Submit Entry"));
> print end_form(), hr();
> }
>
> print end_html;
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
Re: Script not able to work on Server 2003
am 09.10.2007 23:13:50 von unknown
Post removed (X-No-Archive: yes)
Re: Script not able to work on Server 2003
am 10.10.2007 05:23:38 von Ron Bergin
John and Mumia have pointed out most of the problems, but here are
some more.
On Oct 8, 4:10 pm, Joe wrote:
> Here is my code, I picked one of my shorter scripts:
>
> #!/usr/bin/perl -w
>
> # Joe Ruffino Daily WebOpac.pl
> # This program will read in a text file, and print it out
> # in table format
> # Written: January 30, 2004
> # Revised: December 09, 2004, Jan 03, 2005
>
> use CGI qw(:standard :html3);
> use CGI::Carp qw(fatalsToBrowser);
> use strict;
>
> ############################################################ ##############
> # Set Variables
> #
>
> my $ip_hold = 0;
> my $sec;
> my $min;
> my $hour;
> my $day;
> my $month;
> my $year;
> my $ip_list;
> my $monthfind;
> my $monthm;
> my $countip;
>
> my $stationip;
> my $stationname;
>
> my @stationip;
> my @stationname;
>
> my $dayopac;
> my $daym;
> my $dayopacm;
> my $dayfind;
> my $headerpage;
> my $dayflag;
> my $namev;
> my $one;
> my $two;
> my $three;
> my $monthcurr;
> my $monthnow;
> my $countin;
> my $countout;
> my $ip;
> my $date;
> my $time;
> my $firstp;
> my $secondp;
> my $thirdp;
> my $fourthp;
> my $firstip;
> my @firstip;
> my $sn;
> my $count;
> my $date_month;
> my $date_day;
> my $date_year;
> my $i;
> my $ips;
> my @Names;
> my %Names;
> my $ext_ip;
> my %seen;
> my $countint;
> my $totalcnt;
> my $totalline;
> my $station_name;
> my @opacline;
> my %count;
> my @staionip;
> my $line;
> my $opac_month;
> my $hold_date;
> my $date_cnt;
> my $ip_day_cnt;
> my $day_array;
> my $ip_day_cnt;
> my $four;
> my @ext_line;
> my %day_array;
> my %letters;
> my $tot_ip_cnt;
> my $ip_cnt;
> my $four;
>
> ############################################################ ##############
> # Subroutine for finding the text month when numerical month is given
> #
> sub dayfind {
>
> #Setup date field
> if ($dayopacm eq "01") {
> $dayfind = "January"; }
>
> if ($dayopacm eq "02") {
> $dayfind = "February"; }
>
> if ($dayopacm eq "03") {
> $dayfind = "March"; }
>
> if ($dayopacm eq "04") {
> $dayfind = "April"; }
>
> if ($dayopacm eq "05") {
> $dayfind = "May"; }
>
> if ($dayopacm eq "06") {
> $dayfind = "June"; }
>
> if ($dayopacm eq "07") {
> $dayfind = "July"; }
>
> if ($dayopacm eq "08") {
> $dayfind = "August"; }
>
> if ($dayopacm eq "09") {
> $dayfind = "September"; }
>
> if ($dayopacm eq "10") {
> $dayfind = "October"; }
>
> if ($dayopacm eq "11") {
> $dayfind = "November"; }
>
> if ($dayopacm eq "12") {
> $dayfind = "December"; }
> return $dayfind;
>
> }
>
> ############################################################ ##############
> # Subroutine for finding the numerical month when text month is given
> #
> sub monthfind {
>
> #Setup date field
> if ($monthm eq "Jan") {
> $monthfind = "01"; }
>
> if ($monthm eq "Feb") {
> $monthfind = "02"; }
>
> if ($monthm eq "Mar") {
> $monthfind = "03"; }
>
> if ($monthm eq "Apr") {
> $monthfind = "04"; }
>
> if ($monthm eq "May") {
> $monthfind = "05"; }
>
> if ($monthm eq "Jun") {
> $monthfind = "06"; }
>
> if ($monthm eq "Jul") {
> $monthfind = "07"; }
>
> if ($monthm eq "Aug") {
> $monthfind = "08"; }
>
> if ($monthm eq "Sep") {
> $monthfind = "09"; }
>
> if ($monthm eq "Oct") {
> $monthfind = "10"; }
>
> if ($monthm eq "Nov") {
> $monthfind = "11"; }
>
> if ($monthm eq "Dec") {
> $monthfind = "12"; }
> return $monthfind;
>
> }
>
> ############################################################ ##############
> # Find current Time and Date info
> #
> ($sec,$min,$hour,$day,$month,$year) = localtime(time);
> $year = $year +1900;
>
> # ignore used for testing
> $ip_list = "OpacIP";
> # ignore used for testing
>
> ############################################################ ##############
> # Open IP file and test data file
> # Then split IP file into IP address and Station Name array's
> #
> open (LISTIN,"ipnew.txt") || die "Cannot Open File ipadd.txt for
> reading: $!";
>
> while () {
> ($staionip[$countip], $stationname[$countip]) = split(/\s+/);
> $countip++;
>
> }
>
> $stationip = @stationip;
> $stationname = $stationname;
>
> close (LISTIN);
>
> ############################################################ ##############
> # If a file name has been given, process the file
> #
>
> $line = 0;
> if (param()) {
>
> # Set filename entered to a variable
> my $dayopac = param("dayopac");
>
> # Split file name into month and day by assuming a dash is there
> ($dayopacm, $daym) = split(/-/, $dayopac);
> if ($daym) { # if there is a 2-digit day
> $dayflag = "yes";
>
> # find the text month by sending the 2-digit month
> $monthfind = dayfind($dayopacm);
> if ($monthfind eq "December") {
> #$year = $year -1;
> }
> $headerpage = "Daily Stats for " . $monthfind . " " . $daym . ",
> " . $year;
> } else {
>
> # if not a day to be procressed, check to see if it is a month
> to
> # be processed
> $dayflag = "no";
> $daym = "01";
>
> # Split file name into process name and month by assuming an
> # underscore is there
> ($namev, $monthm) = split(/_/, $dayopac);
>
> # find the 2-digit month by sending the text month
> $monthcurr = monthfind($monthm);
>
> # if current month is equal to the month entered
> if ($month eq $monthcurr) { # if it is 1 - 9
> if ($month > 9) {
> $dayopacm = $month; # set current month to month holder
> } else {
> # set current month to month holder and append a '0
> $dayopacm = "0" . $month;
> }
> } else {
> # if not equal set month entered to month holder
> $dayopacm = $monthcurr;
> }
> # Go to subroutine to find the FULL text month
> $monthnow = dayfind($dayopacm);
> if ($monthnow eq "December") {
> $year--;
> }
> ($one, $two, $three, $four) = split(/\\/, $dayopac);
>
> # Set title for HTML Output page using text month that was found
> $headerpage = "Monthly Stats for $monthnow $year";
> }
>
> $ip_list .= "_" . $monthm .".txt";
> open (OPAC_IP, ">$ip_list") || die "$ip_list open failed: $!";
>
> $opac_month = $dayopac . "_" . $year . ".html";
> open (OPAC_WEB, ">$opac_month") || die "$ip_list open failed: $!";
>
> # Append .txt to filename given, and open file for reading
> $dayopac .= ".txt";
> open (OPAC,$dayopac) || die ($dayopac . " open failed: $!");
>
> # Print title on new HTML page and first line
> print OPAC_WEB <
1) You're not specifing the DOCTYPE
"http://www.w3.org/TR/html4/loose.dtd">
>
>
>
> WebOpac $headerpage
>
2) You're missing the opening body tag.
3) HTML tags should be in lowercase, not uppercase.
>
4) The tag is deprecated.
> $headerpage
> END
5) Dynamicaly creating a static html file that you later redirect to
doesn't make sense. Skip the file creation and just output your page.
>
> ($ip,$date,$time,$sn) = split(/ +/);
> $hold_date = $dayopacm . "-" . $daym . "-" . substr(($year - 1900),
> 1,2);
>
> $countin = 0; # zero out counter for ip numbers used in an
> array
> $date_cnt = 0;
> $ip_day_cnt = 0;
>
> while () {
> chomp;
> $countout++; # count number of records processed
>
> ($ip,$date,$time,$sn) = split(/ +/);
>
> # If IP is internal, process
> if ($ip =~ /192.168.33/) {
>
> # Split IP in to 4 parts using a period
> ($firstp,$secondp,$thirdp,$fourthp) = split(/\./, $ip);
>
> # If IP is between 1 and 9, append 00 to it
> if ($fourthp > 0 && $fourthp < 10) {
> $fourthp = "00" . $fourthp;
> } else {
>
> # If IP is between 10 and 99, append 0 to it
> if ($fourthp > 9 && $fourthp < 100) {
> $fourthp = "0" . $fourthp;
> }
> }
> # Assign IP to an array element
> $firstip[$countin] = $fourthp;
>
> # Add 1 to array counter
> $countin++;
> } else {
> if ($date ne $hold_date) {
> foreach $ip (sort keys %day_array) {
> $ip_day_cnt++;
> }
> $tot_ip_cnt += $ip_day_cnt;
> $ext_line[$line] = "" . $hold_date . " has " .
> $ip_day_cnt . " unique External IPs.";
> $date_cnt = 0;
> $ip_day_cnt = 0;
> %day_array = " ";
> $line++;
> }
> $ext_ip++;
> $letters{$ip} = 1;
> $day_array{$ip} = 1;
> $date_cnt++;
> }
> $hold_date = $date;
> }
>
> foreach $ip (sort keys %day_array) {
> $ip_day_cnt++;}
>
> $tot_ip_cnt += $ip_day_cnt;
> $ext_line[$line] = "" . $hold_date . " has " .
> $ip_day_cnt . " unique External IPs.
";
>
> # print OPAC_IP @Names;
> close (OPAC_IP);
>
> foreach $ip (sort keys %letters) {
> $ip_cnt++;
>
> }
>
> #print "
$ip_cnt";
> # Set length of array to variable
> $countint = @firstip;
>
> # Tally distinctive ips
> foreach $ips(@firstip) {
> $count{$ips}++;
> }
>
> foreach $ips(sort(keys %count)) {
> for ($i = 0; $i <= $countip; $i++) {
> if ($ips == $staionip[$i]) {
> $opacline[$totalcnt] = "The Station ".$stationname[$i]."
> b> with IP ".$ips. " has visited Opac ".
> $count{$ips}." times.\n";
> $totalcnt++;
> if ( $count{$ips} > $ip_hold) {
> $ip_hold = $count{$ips};
> $station_name = $i;
> }
> }
>
> }
> }
> close(OPAC);
>
> if ($countint == 0) { $totalcnt = 0;}
>
> if ($dayflag eq "yes") {
> $totalline = "There are " . $totalcnt . " total
> patron stations used for " . $monthfind . " " . $daym . "
> b>.";
> } else {
> $totalline = "There are " . $totalcnt . " total
> patron stations used for the Month of " . $monthnow . "
> b>.";
> }
> print OPAC_WEB hr();
> print OPAC_WEB p("There are " . $countint . "
> internal IP address hits.");
> print OPAC_WEB p("There are " . $ext_ip . " external
> IP address hits.");
> # print p("There are " . ($countout-$countin) . "
> external IP address hits.");
> print OPAC_WEB p("There are " . $countout . " total
> IP address hits.");
> print OPAC_WEB p($totalline);
> print OPAC_WEB p("The Station ".
> $stationname[$station_name]." has the greatest number of hits
> of ".$ip_hold." times.");
> print OPAC_WEB p("There are " . $tot_ip_cnt . " Total
> unique External IP hits for All Days in $monthnow.");
> print OPAC_WEB p("There are " . $ip_cnt . " unique
> External IP hits for the Month of $monthnow.");
> print OPAC_WEB "";
> print OPAC_WEB "Internal<\/A><\/font>";
> print OPAC_WEB "External Hits<\/a> ";
> print OPAC_WEB hr();
>
> for ($i = 0; $i <= $totalcnt; $i++) {
> print OPAC_WEB p($opacline[$i]);
> }
> print OPAC_WEB hr();
> print OPAC_WEB "";
> print OPAC_WEB "External<\/A><\/font>";
> print OPAC_WEB "Internal Hits<\/a>";
> print OPAC_WEB p(@ext_line);
> print OPAC_WEB hr();
> print OPAC_WEB "
";
6) You need to learn the different quoting methods so you can avoid
the "leaning tower syndrom".
If you don't need variable interpolation, then use single quotes
instead of double quotes.
e.g., print OPAC_WEB '';
>
> use CGI; print redirect("$opac_month");
7) Why are you tring to load the CGI module for a second time?
8) The redirect is probably why you're getting a blank page. From
what I can tell, you're only passing the filename. When doing a
redirect, you need to specify the full url, which includes the
protocal.
http://search.cpan.org/~lds/CGI.pm-3.29/CGI.pm#GENERATING_A_ REDIRECTION_HEADER
>
> } else {
>
> ############################################################ ##############
> # If a file name has not been given, process the file, create webpage
> to
> # ask for it
> #
> print header, start_html("Monthly WebOpac"), h1("Monthly WebOpac
> Report");
>
> print hr();
> print start_form();
> print p("Day File: ",textfield("dayopac"), " * form should be
> WebOpac_(3-letter Month)");
> # print p("Check Test: ",checkbox("opaccheck"));
>
> print p(submit("Submit Entry"));
> print end_form(), hr();
>
> }
>
> print end_html;
Re: Script not able to work on Server 2003
am 10.10.2007 06:50:42 von Ron Bergin
I skipped over another important issue, so here it is.
On Oct 9, 8:23 pm, Ron Bergin wrote:
> John and Mumia have pointed out most of the problems, but here are
> some more.
>
> On Oct 8, 4:10 pm, Joe wrote:
>
> > Here is my code, I picked one of my shorter scripts:
>
[snip a bunch]
> > print OPAC_WEB hr();
> > print OPAC_WEB "";
> > print OPAC_WEB "External<\/A><\/font>";
> > print OPAC_WEB "Internal Hits<\/a>";
> > print OPAC_WEB p(@ext_line);
> > print OPAC_WEB hr();
> > print OPAC_WEB "";
>
[snip some more]
>
> > use CGI; print redirect("$opac_month");
>
You're not printing the closing body or html tags.
> > } else {
>
> > ############################################################ ##############
> > # If a file name has not been given, process the file, create webpage
> > to
> > # ask for it
> > #
> > print header, start_html("Monthly WebOpac"), h1("Monthly WebOpac
> > Report");
>
> > print hr();
> > print start_form();
> > print p("Day File: ",textfield("dayopac"), " * form should be
> > WebOpac_(3-letter Month)");
> > # print p("Check Test: ",checkbox("opaccheck"));
>
> > print p(submit("Submit Entry"));
> > print end_form(), hr();
>
> > }
>
> > print end_html;
Re: Script not able to work on Server 2003
am 10.10.2007 07:32:42 von Thrill5
"Tad McClellan" wrote in message
news:slrnfgijc3.4s9.tadmc@tadmc30.sbcglobal.net...
> Joe wrote:
>> I have PERL scripst that I created on a Windows 2000 Server, that work
>> great. We switched to a Windows 2003 Server, PERL is installed, but my
>> script that works on 2000, will not work with the 2003 server. I keep
>> getting the following error on all my scripts:
>>
>> "Content-type: text/html
>>
>> 'C:\Inetpub\wwwroot\cgi-bin\Employee_Status\employee_status. cgi'
>> script produced no output"
>>
>> Plus, I have tried changing the extension to cgi, and I get the same
>> error.
>>
>> Does anyone have any suggestions for me? I'm almost positive it is
>> something simple, but I am just not seeing it.
>
>
> I'm almost positive it has nothing to do with Perl.
>
> It likely has to do with web server configuration.
>
> Ask in a newsgroup about web servers.
>
>
> --
> Tad McClellan
> email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
Have you configured IIS to use Perl for ".pl" and/or ".cgi" files? Have you
checked the IIS log file for errors?